<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core"
                xmlns:constants="http://www.tuanzi.com/constants/tags"
                xmlns:security="http://www.springframework.org/security/tags"
                template="/templates/template.xhtml">
    <ui:define name="title">主体信息</ui:define>
    <ui:define name="content">
        <h:form>
            <div class="topbar clearfix"
                 style="background: -webkit-linear-gradient(top,#f6f7f9 0,#ebedf0 100%);">
                <p:toolbar>
                    <f:facet name="right">
                        <p:commandButton value="编辑" icon="fa fa-edit"
                                         actionListener="#{businessMainInfoBean.changeStatusToEdit}"
                                         process="@this"
                                         update="@form" rendered="#{businessMainInfoBean.isView() and security:areAllGranted('BUSINESS_SECURITY')} "/>
                        <p:commandButton value="保存" icon="fa fa-save"
                                         action="#{businessMainInfoBean.onSave()}"
                                         update="@form"
                                         rendered="#{(businessMainInfoBean.isAdd() || businessMainInfoBean.isEdit() )and security:areAllGranted('BUSINESS_SECURITY')}"/>
                        <p:button value="返回" icon="fa fa-reply-all" href="#{currentUserBean.back}"/>
                    </f:facet>
                </p:toolbar>
            </div>
            <div class="ui-g ui-fluid" style="padding-top: 30px;">
                <div class="ui-g-12 ">
                    <div class="ui-g-12 card">
                        <h1>基础信息</h1>

                        <div class="ui-g-12">
                            <div class="ui-g-2">
                                <p:outputLabel value="渠道主体"/>
                            </div>
                            <div class="ui-g-4">
                                <p:inputText id="companyName" value="#{businessMainInfoBean.$.channelMain}"
                                             disabled="#{businessMainInfoBean.isView()}"/>
                            </div>
                            <div class="ui-g-2">
                                <p:outputLabel value="主体类型"/>
                            </div>
                            <div class="ui-g-4">
                                <p:selectOneMenu id="mainType" value="#{businessMainInfoBean.$.mainType}" disabled="#{businessMainInfoBean.isView()}">
                                    <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                                  noSelectionOption="true"/>
                                    <f:selectItems value="#{businessMainInfoBean.dictionaries[DictionaryCode.BUSINESS_MAIN_TYPE]}"
                                                   var="dic"
                                                   itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                </p:selectOneMenu>
                            </div>
                            <p:panelGrid columns="4" layout="grid"
                                         columnClasses="ui-grid-col-2,ui-grid-col-4,ui-grid-col-2,ui-grid-col-4"
                                         styleClass="ui-panelgrid-blank"
                                         style="border:0px none; background-color:transparent;">
                                <p:outputLabel value="付款方式"/>
                                <p:selectOneMenu value="#{businessMainInfoBean.$.payType}" disabled="#{businessMainInfoBean.isView()}">
                                    <p:ajax event="change" process="@this" update="pay-panel"/>
                                    <f:selectItem itemLabel="- 请选择 -" itemValue=""
                                                  noSelectionOption="true"/>
                                    <f:selectItems
                                            value="#{businessMainInfoBean.dictionaries[DictionaryCode.SETTLEMENT_PAY_MODE]}"
                                            var="dic"
                                            itemLabel="#{dic.name}" itemValue="#{dic.value1}"/>
                                </p:selectOneMenu>
                                <p:outputLabel value="纳税人识别号"/>
                                <p:inputText value="#{businessMainInfoBean.$.idCode}" disabled="#{businessMainInfoBean.isView()}"/>
                            </p:panelGrid>


                            <h:panelGroup id="pay-panel">
                                <div class="ui-g-2">
                                    <p:outputLabel
                                            value="#{businessMainInfoBean.$.payType == 1?'支付宝账户':'开户行'}" disabled="#{businessMainInfoBean.isView()}"/>
                                </div>
                                <div class="ui-g-4">
                                    <p:inputText value="#{businessMainInfoBean.$.bank}" disabled="#{businessMainInfoBean.isView()}"/>
                                </div>
                                <div class="ui-g-2">
                                    <p:outputLabel
                                            value="#{businessMainInfoBean.$.payType == 1?'支付宝账号':'银行卡账号'}" disabled="#{businessMainInfoBean.isView()}"/>
                                </div>
                                <div class="ui-g-4">
                                    <p:inputText value="#{businessMainInfoBean.$.bankId}" disabled="#{businessMainInfoBean.isView()}"/>
                                </div>
                            </h:panelGroup>


                            <div class="ui-g-12" style="padding: 0">
                                <div class="ui-g-2">
                                    <p:outputLabel value="备注"/>
                                </div>
                                <div class="ui-g-10">
                                    <p:inputText value="#{businessMainInfoBean.$.remark}" disabled="#{businessMainInfoBean.isView()}"/>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>
            </div>
        </h:form>
    </ui:define>
</ui:composition>